const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
  // Write your code here
  line = await readline();
  num1 = await readline();
  input1 = await readline();
  num2 = await readline();
  while ((input2 = await readline())) {
    //n=4 k=2 输入1122 输出2   n=6 k=4 输入121212 输出3
    numa = num1.split(" ");
    numb = num2.split(" ");
    let a = parseInt(numa[1]);
    let b = parseInt(numb[1]);
    console.log(luckyStr(input1, a));
    console.log(luckyStr(input2, b));
    function luckyStr(s, k) {
      if (k % 2 !== 0 || k < 2 || k > s.length) {
        return 0;
      }
      const half = k / 2;
      const nums = [];
      for (let i = 0; i < s.length; i++) {
        nums.push(s.charCodeAt(i) - 48);
      }
      let leftSum = 0;
      let rightSum = 0;
      for (let i = 0; i < half; i++) {
        leftSum += nums[i];
        rightSum += nums[i + half];
      }
      let count = 0;
      if (leftSum === rightSum) {
        count++;
      }
      for (let i = 1; i + k - 1 < s.length; i++) {
        leftSum = leftSum - nums[i - 1] + nums[i - 1 + half];
        rightSum = rightSum - nums[i - 1 + half] + nums[i - 1 + k];

        if (leftSum === rightSum) {
          count++;
        }
      }
      return count;
    }
  }
})();
/* 2
4 2
1122
6 4
121212
输出
2
3 */
